// 组织架构的接口
import request from '@/utils/request'

// 获取树形结构的企业的部门列表
export function getDepartments() {
  return request({
    url: '/company/department',
    method: 'get'
  })
}

// 根据ID删除部门
export function deleteDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete' // 接口满足restful接口规范
  })
}

// 新增部门
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

// 根据ID修改部门详情
export function updateDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}

// 根据ID查询部门详情
export function getDepartDetail(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}
